package com.sks.bean.pojo;

import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Metro entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "metro", uniqueConstraints = { @UniqueConstraint(columnNames = { "name" }) })
public class Metro implements java.io.Serializable {

   // Fields

   private Integer metroId;
   private String name;
   private List<MetroStation> metroStationsForMetroId = new ArrayList<MetroStation>(0);
   /*private Set<MetroStation> metroStationsForMetroId1 = new HashSet<MetroStation>(
         0);*/

   // Constructors

   /** default constructor */
   public Metro() {
   }

   /** minimal constructor */
   public Metro(Integer metroId, String name) {
      this.metroId = metroId;
      this.name = name;
   }

   /** full constructor */
   public Metro(Integer metroId, String name,
		   List<MetroStation> metroStationsForMetroId) {
      this.metroId = metroId;
      this.name = name;
      this.metroStationsForMetroId = metroStationsForMetroId;
     // this.metroStationsForMetroId1 = metroStationsForMetroId1;
   }

   // Property accessors
   @Id
   @GeneratedValue(strategy=GenerationType.AUTO)
   @Column(name = "metroId", unique = true, nullable = false, insertable = true, updatable = true)
   public Integer getMetroId() {
      return this.metroId;
   }

   public void setMetroId(Integer metroId) {
      this.metroId = metroId;
   }

   @Column(name = "name", unique = true, nullable = false, insertable = true, updatable = true, length = 40)
   public String getName() {
      return this.name;
   }

   public void setName(String name) {
      this.name = name;
   }

   @OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "metroByMetroId")
   @OrderBy("stationId ASC")
   public List<MetroStation> getMetroStationsForMetroId() {
      return this.metroStationsForMetroId;
   }

   public void setMetroStationsForMetroId(
		   List<MetroStation> metroStationsForMetroId) {
      this.metroStationsForMetroId = metroStationsForMetroId;
   }

   /*@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "metroByMetroId1")
   public Set<MetroStation> getMetroStationsForMetroId1() {
      return this.metroStationsForMetroId1;
   }

   public void setMetroStationsForMetroId1(
         Set<MetroStation> metroStationsForMetroId1) {
      this.metroStationsForMetroId1 = metroStationsForMetroId1;
   }*/

}